package com.google.gwt.livinglife.client;

import com.google.gwt.livinglife.client.data.ChallengeData;
import com.google.gwt.livinglife.client.data.CommentData;
import com.google.gwt.livinglife.client.data.LivingLifeGroupData;
import com.google.gwt.livinglife.client.data.LivingLifeUserData;
import com.google.gwt.livinglife.client.data.ResponseData;
import com.google.gwt.livinglife.client.data.UserIdData;
import com.google.gwt.user.client.rpc.AsyncCallback;

public interface LivingLifeServiceAsync {
	 // Each of the following add* methods return the datastore long key for the corresponding
	// object.
	public void addChallenge(ChallengeData challenge, AsyncCallback<Long> async) throws NotLoggedInException;
  public void addResponse(ResponseData response, AsyncCallback<Long> async) throws NotLoggedInException;
  public void addComment(CommentData comment, AsyncCallback<Long> async) throws NotLoggedInException;
  public void addGroup(LivingLifeGroupData group_data, UserIdData founder, AsyncCallback<Long> async) throws NotLoggedInException;
  public void deleteGroup(Long group_id, AsyncCallback<Void> async) throws NotLoggedInException;
  public void updateUserData(LivingLifeUserData user_data, AsyncCallback<Void> async) throws NotLoggedInException;
  
  public void addUserToGroup(String user_id, Long group_id, AsyncCallback<Void> async)  throws NotLoggedInException;
  public void removeUserFromGroup(String user_id, Long group_id, AsyncCallback<Void> async) throws NotLoggedInException;
  
  // Increment counters and return the current value of count for them.
  public void likeStory(Long story_id, AsyncCallback<Integer> async)  throws NotLoggedInException;
  public void inspiredBy(Long story_id, AsyncCallback<Integer> async)  throws NotLoggedInException;
  public void inappropriateStory(Long story_id, AsyncCallback<Integer> async) throws NotLoggedInException;

  // Query for Challenges using a selector object
  public void getChallenges(ChallengeSelector selector, AsyncCallback<ChallengeData[]> async);
  
  // Request additional responses for a given challenge
  public void getAdditionalResponses(AdditionalPostSelector selector, AsyncCallback<ResponseData[]> async);
  // Request additional comments for a given challenge or a given response  
  public void getAdditionalComments(AdditionalPostSelector selector, AsyncCallback<CommentData[]> async);
  
  public  void getGroupById(Long id, AsyncCallback<LivingLifeGroupData> async) throws ObjectNotFoundException;
  
  public  void getGroupByName(String groupName, AsyncCallback<LivingLifeGroupData> async) throws ObjectNotFoundException;
  
  public  void getTopGroups(GroupSelector selector, AsyncCallback<LivingLifeGroupData[]> async);
  
  public  void getUserById(String id, AsyncCallback<LivingLifeUserData> async) throws ObjectNotFoundException;
  
  public  void getUserByNickname(String name, AsyncCallback<LivingLifeUserData[]> async) throws ObjectNotFoundException;
  
  public  void getUserByEmail(String email, AsyncCallback<LivingLifeUserData[]> async) throws ObjectNotFoundException;
  
  public  void getChallengeById(Long Challenge, AsyncCallback<ChallengeData> async) throws ObjectNotFoundException;
}
